package Map1;

import lombok.Data;

import java.util.Objects;

@Data
public class Person implements Comparable<Person>{
    private String name;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person person = (Person) o;
        return age == person.age && Objects.equals(name, person.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }

    private int age;

    Person(String n , int a){
        name = n;
        age = a;
    }

    @Override
    public int compareTo(Person o) {
        return this.age - o.getAge();
    }
}
